/**
 * 
 */
package tests;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @author smriti
 *
 */
public class GetStuff {
	private static InputStreamReader reader = null;
	private static BufferedReader bfReader = null;
	
	static{
		reader = new InputStreamReader(System.in);
		bfReader = new BufferedReader(reader);
	}

	public static String getStrChoice() throws IOException{		
		//return bfReader.readLine();
		String str = bfReader.readLine();
		if (str.trim().length() == 0)
			return null;
		return str.trim ();
	}
	
	public static int getIntChoice() throws Exception{
		int conf = -1;
		try{
			String str = bfReader.readLine();
			if(null != str)
			conf = Integer.parseInt(str.trim());
		}catch (Exception e) {
			throw new Exception("Please enter a valid float value");
		}
		
		return conf;
	}

	public static float getFloatChoice() throws Exception {
		float conf = (float)0.0;
		try{
			String str = bfReader.readLine();
			if(null != str && !str.equals(""))
				conf = Float.parseFloat(str.trim());
		}catch (Exception e) {
			throw new Exception("Please enter a valid float value");
		}
		
		return conf;
	}
}
